{% extends "bootstrap/base.html" %}

{% block title %}Garbage{% endblock %}

{% block head %}
    {{ super() }}
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='viewer.min.css') }}">
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.png') }}">
{% endblock %}

{% block navbar %}
    <div class="navbar navbar-inverse" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="-iconbar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="{{ url_for('index') }}">Garbage Sort</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li {% if request.endpoint == 'index' %}class="active"{% endif %}>
                        <a href="{{ url_for('index') }}">主页</a>
                    </li>
                    {% if current_user.role == 'admin' %}
                        <li {% if request.endpoint == 'upload_file' %}class="active"{% endif %}>
                            <a href="{{ url_for('upload_file') }}">垃圾分类</a>
                        </li>
                        <li {% if request.endpoint == 'manage_users' %}class="active"{% endif %}>
                            <a href="{{ url_for('manage_users') }}">用户管理</a>
                        </li>
                    {% endif %}
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if current_user.is_authenticated %}
                        <li><a href="{{ url_for('logout') }}">Log Out</a></li>
                    {% else %}
                        <li><a href="{{ url_for('login') }}">Log In</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
{% endblock %}

{% block content %}
    <div class="container-body">
        {% for message in get_flashed_messages() %}
            <div class="alert alert-warning">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ message }}
            </div>
        {% endfor %}

        {% block page_content %}{% endblock %}
    </div>
{% endblock %}